<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterActivityAddIsAttendOpenActivity extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('activities', function (Blueprint $table) {
            $table->unsignedInteger('isAttendOpenActivity')->default(0)
                  ->comment('是否参开业活动')
                  ->after('isAttendEd');

            $table->unsignedBigInteger("thresholdAmount")->default(0)->comment("赠品满足门槛")->after("description");
            $table->string("channel", 64)->default("")->comment("活动渠道 1 - 小程序 2 - pos")->after("description");
            $table->unsignedTinyInteger("posAutoJoin")->default(0)->comment("pos自动参加活动 0 - 否 1 - 是")
                  ->after("description");
            $table->unsignedTinyInteger("productType")->default(0)->comment("菜品类型 0 - 全部 1 - 部分")
                  ->after("shopType");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('activities', function (Blueprint $table) {
            $table->dropColumn(["isAttendOpenActivity", "channel", "posAutoJoin", "productType"]);
        });
    }
}
